
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>留言板</title>
    <style>
        .contaiter{
            width: 350px;
            height: 300px;
            text-align: center;
        }
        .grey{
            color: grey;
        }
        .contaiter .row{
            width: 350px;
            height: 40px;
            display: flex;
            justify-content: space-between;
        }
        .contaiter .row input{
            width: 260px;
            height: 30px;
        }
        #submit {
            width: 350px;
            height: 40px;
            background-color: orange;
            color: white;
            border: none;
            margin: 10px;
            border-radius: 5px;
            font-size: 20px;
            cursor: pointer;
        }
    </style>
</head>
<body>
    <div class="contaiter">
        <h1>留言板</h1>
        <p class="grey">输入后点击提交，会将信息显示在表格中</p>
        <div class="row">
            <span>谁:</span><input type="text" id="from">
        </div>
        <div class="row">
            <span>对谁:</span><input type="text" id="to">
        </div>
        <div class="row">
            <span>说什么:</span><input type="text" id="say">
        </div>
        <input type="button" value="提交" id="submit" onclick="submitnm()">
    </div>
    <script src="jquery-3.7.1.min.js"></script>
    <script>
        function submitnm(){
            let from=$("#from").val();
            let to=$("#to").val();
            let say=$("#say").val();
            if(from===""||to===""||say===""){
                return;
            }
            let html="<div>"+from+"对"+to+"说"+say+"</div>";
            $(".contaiter").append(html);
            // $("#from").val("");
            // $("#to").val("");
            // $("#say").val("");
        
        }
    </script>
</body>
</html>